package com.redsoil.house.ui.news.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.redsoil.house.R;
import com.redsoil.house.base.BaseViewHolderTSK;
import com.redsoil.house.model.bean.DictListVO;
import com.redsoil.house.model.bean.NewsVO;
import com.redsoil.house.model.http.api.ApiConstants;
import com.zhy.autolayout.utils.AutoUtils;

import java.util.List;

/**
 * Created by weidingqiang on 2018/12/20.
 */

public class NewsTitleAdapter extends BaseAdapter{

    private List<DictListVO.DataListBean> mList;

    private LayoutInflater mInflater;

    public NewsTitleAdapter(Context context, List<DictListVO.DataListBean> list) {
        this.mList = list;
        mInflater = LayoutInflater.from(context);
    }

    @Override
    //ListView需要显示的数据数量
    public int getCount() {
        return mList.size();
    }

    @Override
    //指定的索引对应的数据项
    public Object getItem(int position) {
        return mList.get(position);
    }

    @Override
    //指定的索引对应的数据项ID
    public long getItemId(int position) {
        return position;
    }


    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = mInflater.inflate(R.layout.news_title_item,null);

        TextView titleTextView = (TextView) view.findViewById(R.id.title_tv);

        DictListVO.DataListBean bean = mList.get(position);

        titleTextView.setText(bean.getValue());

        AutoUtils.autoSize(view);

        return view;
    }
}
